/**
 * 相关案例的Service
 * Created by Administrator on 2016/12/29.
 */
module.exports = function ($http,httpservice,$q) {
    var caseBarDetailAnLiService = {};

    /**相关案例*/
    caseBarDetailAnLiService.RefuseMsg = function (index,pagesize,conditions,caseId) {
        var  params ={"index":index,"pagesize":pagesize,"conditions":conditions,"caseId":caseId};
        var deferred = $q.defer();
        $http({
            method: 'POST',
            url: httpservice.CorrelationCaseUrl,
            data:params,
            headers : {'Content-Type':'application/json'}
        }).then(function successCallback(response) {
            deferred.resolve(response.data);
        }, function errorCallback(response) {
            deferred.reject(response);
        });
        return deferred.promise;
    };
 /*   /!**相关案例详情*!/
    caseBarDetailAnLiService.RefuseMsg1 = function (index,pagesize,conditions) {
        var  params ={"index":index,"pagesize":pagesize,"conditions":conditions};
        var deferred = $q.defer();
        $http({
            method: 'GET',
          //  url: httpservice.CorrelationCaseUrl,
            url:"http://59.110.64.34:8088/solr/getDocByKeyWord?index=0&pagesize=10&conditions=searchWord:%E7%BA%A0%E7%BA%B7&conditions=searchWord:%E6%A1%88",
           // data:params,
            headers : {'Content-Type':'application/json'}
        }).then(function successCallback(response) {
            deferred.resolve(response.data);
        }, function errorCallback(response) {
            deferred.reject(response);
        });
        return deferred.promise;
    };*/
    /**关注和取消关注*/
    caseBarDetailAnLiService.Enshrine = function (relatedId,caseId,relatedStatus,relatiedInfo,userId,relatedName) {
       /* userId：用户id，relatedName：相关案例名称*/
        var  params ={"relatedId":relatedId,"caseId":caseId,"relatedStatus":relatedStatus,"relatedInfo":relatiedInfo,"userId":userId,"relatedName":relatedName};
        var deferred = $q.defer();
        $http({
            method: 'POST',
            url: httpservice.CollectionRelatedCaseUrl,
            data:params,
            headers : {'Content-Type':'application/json'}
        }).then(function successCallback(response) {
            deferred.resolve(response.data);
        }, function errorCallback(response) {
            deferred.reject(response);
        });
        return deferred.promise;
    };


    return caseBarDetailAnLiService;
}
